package com.heima.behavior.controller;

import com.heima.behavior.service.ApBehaviorEntryService;
import com.heima.model.behavior.dtos.*;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "用户行为喜欢点赞判定")
@RestController
@RequestMapping("/api/v1")
public class ApLikesBehaviorController {
    @Autowired
    ApBehaviorEntryService apLikesBehaviorService;


    @ApiOperation(value = "喜欢就点赞")
    @PostMapping("/likes_behavior")
    public ResponseResult Likes(@RequestBody @Validated LikesBehaviorDTO dto) {
        return apLikesBehaviorService.like(dto);
    }

    @ApiOperation(value = "不喜欢的列表")
    @PostMapping("/un_likes_behavior")
    public ResponseResult unlikeBehavior(@RequestBody @Validated UnLikesBehaviorDTO dto) {
        return apLikesBehaviorService.unlikeBehavior(dto);
    }

    @ApiOperation(value = "阅读的列表")
    @PostMapping("/read_behavior")
    public ResponseResult readBehavior(@RequestBody @Validated ReadBehaviorDTO dto) {
        return apLikesBehaviorService.readBehavior(dto);
    }

    @ApiOperation(value = "收藏的列表")
    @PostMapping("/collection_behavior")
    public ResponseResult collectBehavior(@RequestBody @Validated CollectionBehaviorDTO dto) {
        return apLikesBehaviorService.collectBehavior(dto);
    }

    @ApiOperation(value = "查询文章行为")
    @PostMapping("/article/load_article_behavior")
    public ResponseResult loadArticleBehavior(@RequestBody @Validated ArticleBehaviorDTO dto) {
        return apLikesBehaviorService.loadArticleBehavior(dto);
    }


}



